package com.ruoyi.common.core.domain;

import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.enums.SocketTypeEnum;
import lombok.Data;

@Data
public class SocketResult {
    private SocketTypeEnum type;
    private Object data;
    private int index;

    public static String ok(SocketTypeEnum type){
        return ok(type,null);
    }
    public static String ok(SocketTypeEnum type,Object data){
        SocketResult rs=new SocketResult();
        rs.setType(type);
        rs.setData(data);
        return JSONObject.toJSONString(rs);
    }

    public static String ok(SocketTypeEnum type,Object data,int index){
        SocketResult rs=new SocketResult();
        rs.setType(type);
        rs.setData(data);
        rs.setIndex(index);
        return JSONObject.toJSONString(rs);
    }
}
